package iodemo;

import java.io.*;

public class KeyIO
{
    public static void main (String[] args)
    {
        try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out)))
        {
            System.out.println("请输入：（输入q退出程序）");
            
            while(true)
            {
                String string = bufferedReader.readLine();
    
                if("q".equals(string))
                {
                    break;
                }
                
                bufferedWriter.write(String.valueOf(string));
                
                bufferedWriter.newLine();
                bufferedWriter.flush();
            }
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }
    }
}
